package nowcoder.written_examination.google;

import org.junit.Test;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 *
 * @author fance
 * @date 18-6-26 上午6:11
 */
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            int n = in.nextInt();
            int m = in.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
            }


        }

    }
    /**
     * 返回从源字符串到目标字符串的最小操作数
     * source: 源字符串
     * target：目标字符串
     * 返回：最小操作数
     */
    public int minOperationCount(String source, String target) {
        if (source == null || source.length() == 0) {
            return target.length();
        }
        char[] src = source.toCharArray();
        char[] des = target.toCharArray();
        int[][] op = new int[src.length + 1][des.length + 1];
        for (int i = 1; i <= src.length; i++) {
            op[i][0] = i;
        }
        for (int i = 1; i <= des.length; i++) {
            op[0][i] = i;
        }
        for (int i = 1; i <= src.length; i++) {
            for (int j = 1; j <= des.length; j++) {
                if (src[i - 1] == des[j - 1]) {
                    op[i][j] = op[i - 1][j - 1];
                } else {
                    op[i][j] = Math.min(op[i -1][j - 1],Math.min(op[i - 1][j],op[i][j - 1])) + 1;
                }
            }
        }
        return op[src.length][des.length];
    }
@Test
    public void test() {
    System.out.println(minOperationCount("","a"));
    System.out.println(minOperationCount("a","a"));
    System.out.println(minOperationCount("a","b"));
    }
    /**
     * 获取n个素数
     * n: 素数个数
     * 返回：最小的N个素数
     */
    public List<Integer> getPrimes(int n) {
        List<Integer> ret = new ArrayList<Integer>();
        int i = 2;
        int cnt = 0;
        while (cnt < n) {
            if (isPrimes(i)) {
                ret.add(i);
                cnt++;
            }
            i++;
        }
        return ret;
    }
    public boolean isPrimes(int n) {
        for (int i = 2; i < n; i++) {
            if (n % i == 0) {
                return false;
            }
        }
        return true;
    }

}
